import requests
from lxml import etree
import re
if __name__ == "__main__":
    url = 'https://bi.bi/download/'
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) \
        AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.\
        0.4324.150 Safari/537.36',
        'cookie': '__cfduid=d05e6341a21dfab48b3e75ecae89cda481612017237; swpm_in_use=swpm_in_use; simple_wp_membership_sec_b098a5f6f2c7ac89d58de9b45622afe0=daidai|1613227066|6e0e55adce10a27e18cb452cb9e23b60; wordpress_logged_in_b098a5f6f2c7ac89d58de9b45622afe0=daidai|1613227066|Coo5vmyShjeNUWgLTuivaIjqD2syTQCzBgcbSrOC3j4|db186a27c7099286e0aca3717d210b4ae75e4efccd4b8e0ec7edd6df3078fa01; swpm_session=c0b7d00f2052d3b30abf708323d93105'
    }
    page_text = requests.get(url=url, headers=headers).text
    #print(page_text)


    tree = etree.HTML(page_text)
    li_list = tree.xpath('//div[@class="entry-content"]/ul//a/@href  | //div[@class="entry-content"]/ol//a/@href')
    # li_name = tree.xpath('//div[@class="entry-content"]/ul//a/text() | //div[@class="entry-content"]/ol//a/text()')
    # print(li_name)
    # print(len(li_list))
    ex = 'https://linkyoulimited-my.sharepoint.com.*'
    right_list = []
    for i in li_list:
        aa = re.findall(ex, i)
        # print(aa)
        if aa:
            print(aa)
            right_list.append(aa[0])

    # print(right_list)
    # print(len(right_list))
